import { BasicFetchResult } from '/@/api/model/baseModel';

export interface GovernanceListItem {
  id: string;
  scenarioId: string;
  strategyName: string;
  strategyMethod: string;
  isEnabled: string;
  viewParams: string;
  lastUpdateTime: string;
  label: string;
  value: string;
}

export type GouvernanceResult = BasicFetchResult<GovernanceListItem>;

export interface ScenarioItem {
  scenarioName: string;
  id: string;
  label: string;
  value: string;
}

export type GovernancePageParam = {
  scenarioId: string;
  strategyMethod: string;
  current: number;
  size: number;
};

export type PageParams = {
  scenarioId: string;
  strategyMethod: string;
};

export type rateLimitingParams = {
  rate: string;
  limitRefreshPeriod: string;
  rlTimeUnit: string;
};

export type retryParams = {
  retryOnResponseStatus: string;
  maxAttempts: string;
  retryStrategy: string;
  initialInterval: string;
  multiplier: string;
  waitDuration: string;
  rtTimeUnit: string;
};

export type bulkheadParams = {
  maxConcurrentCalls: string;
  maxWaitDuration: string;
  bhTimeUnit: string;
};

export type circuitBreakerParams = {
  slidingWindowType: string;
  slidingWindowSize: string;
  windowSizeUnit: string;
  minimumNumberOfCalls: string;
  failureRateThreshold: string;
  slowCallDurationThreshold: string;
  slowCallTimeUnit: string;
  slowCallRateThreshold: string;
};

export interface GovernanceDetailItem {
  id: string;
  strategyMethod: string;
  strategyName: string;
  scenarioId: string;
  scenarioName: string;
  retryParams: retryParams;
  rateLimitingParams: rateLimitingParams;
  bulkheadParams: bulkheadParams;
  circuitBreakerParams: circuitBreakerParams;
}

export type CreateGovernancePageParam = {
  id: string;
  strategyMethod: string;
  strategyName: string;
  scenarioId: string;
  isEnabled: boolean;
  retryParams: retryParams;
  rateLimitingParams: rateLimitingParams;
  bulkheadParams: bulkheadParams;
  circuitBreakerParams: circuitBreakerParams;
};

export type EditGovernancePageParam = CreateGovernancePageParam;

export type ChangeGovernanceStateParam = {
  strategyId: string;
};

export type DeleteGovernancePageParam = {
  strategyId: string;
};

export type getScenarioListParam = {
  strategyMethod: string;
};

export type ViewGovernancePageParam = DeleteGovernancePageParam;
